<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>麦知网——学问有余，可为人师</title>

<!-- Bootstrap core CSS -->
<link href="../css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../css/non-responsive.css" rel="stylesheet">
<link href="../css/font-awesome.min.css" rel="stylesheet">
<link href="../css/theGroup.css" rel="stylesheet">    
<link href="../css/sco.message.css" rel="stylesheet">
<link href="../css/bootstrap-switch.css" rel="stylesheet">
<link href="../css/scojs.css" rel="stylesheet">  
<link href="../ico/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon"/>
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="../js/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="../js/bootstrap.js"></script>
<script src="../js/change.js"></script>
<script src="../js/add.js"></script>
<script src="../js/ban.js"></script>
<script src="../js/dt.js"></script>
<script src="../js/sco.message.js"></script>
<script src="../js/logout.js"></script>
<script src="../js/bootstrap-switch.js"></script>
<script src="../js/bad.js"></script>
</head>
<body>
	{% include 'public/common/header.html' %}
	<div class="container" style="margin-top:45px">
		<div class="row">
<!-- left div -->
			<div class="col-xs-7">
<!-- 小组信息div -->
				<div class="groupMes">
					<div class="group_img pull-left">
						<img src="{{group.domain}}/{{group.img}}" width="100%" />
					</div>
					<div class="group_names pull-left">
						<div class="group_name">
							<span><b>{{group.name}}</b></span>
<!-- 别人的小组 未加入时  用这个 -->
							<span style="margin-left:20px">{{group.crew_con}}位组员</span>
							{% ifequal status '3' %}
							<div class="switchDiv" style="margin-top:30px">
								<div class="switch switch-small" data-on="info" data-off="NO">
									<input type="checkbox" checked="checked" id="join({{group.id}})" onchange="join({{group.id}})"/> 
								</div>
							</div>
							{% endifequal %}
							{% ifequal status '4' %}
							<div class="switchDiv" style="margin-top:30px">
								<div class="switch switch-small" data-on="info" data-off="NO">
									<input type="checkbox" id="left" onchange="join({{group.id}})"/> 
								</div>
							</div>
							{% endifequal %}
<!-- 别人的小组 已加入时  用这个 -->
							{% ifequal status '2' %}
							<div class="switchDiv" style="margin-top:30px">
								<div class="switch switch-small" data-on="info" data-off="NO">
									<input type="checkbox" id="left" onchange="join({{group.id}})"/> 
								</div>
							</div>
							{% endifequal %}
<!-- 我的小组  用这个-->				
							{% ifequal status '1' %}			
							<span class="my_group">我的小组</span>
							{% endifequal %}
						</div>
<!-- 我的小组  才有
						{% ifequal status '1' %}	
						<div class="change_img"><a id="change_img" href="#" data-toggle="popover" data-placement="bottom" data-content="<div><form action='{% url 'groups:thegroup' group.id %}' method='post' enctype='multipart/form-data'>{% csrf_token %}<div><input type='file' name='groupImg'></div><div style='margin-top:15px;text-align:center'><input type='submit' value='确认修改'></div></form></div>" data-original-title title><b>修改图片</b></a></div>
						{% endifequal %}-->
					</div>
					<div class="clearfix"></div>
				</div>
				<div class="group_intro">
					<div class="topdirection"></div>
					<div class="group_introduce">
<!-- 我的小组  才有-->
						{% ifequal status '1' %}	
						<div class="change_intro"><a id="change_intro" href="javascript:void(0)" data-toggle="popover" data-placement="bottom" data-content="<div><div><textarea id='intro' name='intro' style='resize:none;width:200px;'></textarea></div><div style='margin-top:15px;text-align:center'><button type='button' onclick='change({{group.id}})' class='btn btn-default btn-xs'>确认修改</button></div></div>" data-original-title title><b>修改</b></a></div>
						{% endifequal %}
						<div id="groupintro"><i>{{group.introduce}}</i></div>
					</div>
				</div>
				<div class="create_topic">
					{% ifequal status '1' %}
					<a href="{% url 'groups:topiccreate' group.id %}" type="button" class="btn btn-default">发布新话题</a>
					{% endifequal %}
					{% ifequal status '2' %}
					<a href="{% url 'groups:topiccreate' group.id %}" type="button" class="btn btn-default">发布新话题</a>
					{% endifequal %}
					{% ifequal status '3' %}
					<div id="jointopub">加入小组以发布新话题</div>
					{% endifequal %}
					{% ifequal status '4' %}
					您被小组组长封禁，暂时不能发布话题
					{% endifequal %}
				</div>
				<div class="topics">
<!-- 别人的小组 显示开始处 -->
					{% ifequal status '4' %}	
					<table class="table table-hover">
							<thead>
								<tr>
									<th class="th1">话题</th>
									<th class="th2">作者</th>
									<th class="th3">更新时间</th>
									<th class="th4">回复数</th>
								</tr>
							</thead>
							<tbody>
<!--  一条话题循环开始处 -->
						{% for t in topic %}
								<tr>
									<td class="td1">
										<div class="td_12"><a href="{% url 'groups:thetopic' t.4 %}" title="{{t.1}}" target="_blank">{{t.1}}</a></div>
									</td>
									<td><div class="td_text"><a href="{% url 'users:home' t.5 %}">{{t.0}}</a></div></td>
									<td><div class="td_text">{{t.2|date:"Y-m-d H:i"}}</div></td>
									<td><div class="td_text">{{t.3}}</div></td>
								</tr>
						{% endfor %}
<!-- 一条话题循环结束处 -->
							</tbody>
						</table>
						<ul class="pager">
						{% if topics.has_previous %}
						  <li><a href="?page={{ topics.previous_page_number }}">&larr;上一页</a></li>
						{% endif %}
						共 {{ topics.number }} 页  第 {{ topics.paginator.num_pages }} 页.
						{% if topics.has_next %}
						  <li><a href="?page={{ topics.next_page_number }}">下一页&rarr;</a></li>
						{% endif %}
						</ul>
						{% endifequal %}
					{% ifequal status '3' %}	
					<table class="table table-hover">
							<thead>
								<tr>
									<th class="th1">话题</th>
									<th class="th2">作者</th>
									<th class="th3">更新时间</th>
									<th class="th4">回复数</th>
								</tr>
							</thead>
							<tbody>
<!--  一条话题循环开始处 -->
						{% for t in topic %}
								<tr>
									<td class="td1">
										<div class="td_12"><a href="{% url 'groups:thetopic' t.4 %}" title="{{t.1}}" target="_blank">{{t.1}}</a></div>
									</td>
									<td><div class="td_text"><a href="{% url 'users:home' t.5 %}">{{t.0}}</a></div></td>
									<td><div class="td_text">{{t.2|date:"Y-m-d H:i"}}</div></td>
									<td><div class="td_text">{{t.3}}</div></td>
								</tr>
						{% endfor %}
<!-- 一条话题循环结束处 -->
							</tbody>
						</table>
						<ul class="pager">
						{% if topics.has_previous %}
						  <li><a href="?page={{ topics.previous_page_number }}">&larr;上一页</a></li>
						{% endif %}
						共 {{ topics.number }} 页  第 {{ topics.paginator.num_pages }} 页.
						{% if topics.has_next %}
						  <li><a href="?page={{ topics.next_page_number }}">下一页&rarr;</a></li>
						{% endif %}
						</ul>
						{% endifequal %}
<!-- 别人的小组 显示结束处 -->
<!-- 别人的小组 显示开始处 -->
					{% ifequal status '2' %}	
					<table class="table table-hover">
							<thead>
								<tr>
									<th class="th1">话题</th>
									<th class="th2">作者</th>
									<th class="th3">更新时间</th>
									<th class="th4">回复数</th>
								</tr>
							</thead>
							<tbody>
<!--  一条话题循环开始处 -->
						{% for t in topic %}
								<tr>
									<td class="td1">
										<div class="td_12"><a href="{% url 'groups:thetopic' t.4 %}" title="{{t.1}}" target="_blank">{{t.1}}</a></div>
									</td>
									<td><div class="td_text"><a href="{% url 'users:home' t.5 %}">{{t.0}}</a></div></td>
									<td><div class="td_text">{{t.2|date:"Y-m-d H:i"}}</div></td>
									<td><div class="td_text">{{t.3}}</div></td>
								</tr>
						{% endfor %}
<!-- 一条话题循环结束处 -->
							</tbody>
						</table>
						<ul class="pager">
						{% if topics.has_previous %}
						  <li><a href="?page={{ topics.previous_page_number }}">&larr;上一页</a></li>
						{% endif %}
						共 {{ topics.number }} 页  第 {{ topics.paginator.num_pages }} 页.
						{% if topics.has_next %}
						  <li><a href="?page={{ topics.next_page_number }}">下一页&rarr;</a></li>
						{% endif %}
						</ul>
						{% endifequal %}
<!-- 别人的小组 显示结束处 -->
<!-- 我的小组 显示开始处 -->
						{% ifequal status '1' %}	
						<table class="table table-hover">
							<thead>
								<tr>
									<th class="tth1">话题</th>
									<th class="tth2">作者</th>
									<th class="tth3">更新时间</th>
									<th class="tth4">回复</th>
									<th class="tth4">操作</th>
								</tr>
							</thead>
							<tbody>
<!--  一条话题循环开始处 -->
							{% for t in topic %}
								<tr>
									<td class="td1">
										<div class="ttd_12"><a href="{% url 'groups:thetopic' t.4 %}" title="{{t.1}}" target="_blank">{{t.1}}</a></div>
									</td>
									<td><div class="td_text"><a href="{% url 'users:home' t.5 %}">{{t.0}}</a></div></td>
									<td><div class="td_text">{{t.2|date:"Y-m-d H:i"}}</div></td>
									<td><div class="td_text">{{t.3}}</div></td>
									<td><div class="td_text"><a class="manage" href="javascript:void(0)" data-toggle="popover" data-placement="bottom" data-content="<div><div><a href='javascript:void(0)' onclick='dt({{t.4}})'>删除话题</a></div>{% ifequal t.7 '2' %}<div style='margin-top:5px;'><!-- 未被封禁的用户 开始处 -->{% ifequal t.6 1 %}<a href='javascript:(0)' class='lock{{t.5}}' onclick='ban({{t.5}})'>封禁用户</a>{% endifequal %}<!-- 未被封禁的用户 结束处 --><!-- 已经被封禁的用户 开始处 -->{% ifequal t.6 2 %}<a href='javascript:(0)' class='unlock{{t.5}}' onclick='ban({{t.5}})'>解封用户</a>{% endifequal %}<!-- 已经被封禁的用户 结束处 --></div>{% endifequal %}</div>" data-original-title title>管理</a></div></td>
								</tr>
							{% endfor %}
<!-- 一条话题循环结束处 -->
							</tbody>
						</table>
						<ul class="pager">
						{% if topics.has_previous %}
						  <li><a href="?page={{ topics.previous_page_number }}">&larr;上一页</a></li>
						{% endif %}
						共 {{ topics.number }} 页  第 {{ topics.paginator.num_pages }} 页.
						{% if topics.has_next %}
						  <li><a href="?page={{ topics.next_page_number }}">下一页&rarr;</a></li>
						{% endif %}
						</ul>
						{% endifequal %}
<!-- 我的小组 显示结束处 -->
				</div>
			</div>
<!-- 中间留白div -->
			<div class="col-xs-1">

			</div>
<!-- right div -->
			<div class="col-xs-4">
				<div class="up_file">
					<!--{% ifequal status '3' %}
					<span><a type="button" id="up_file" class="btn btn-warning btn_file" href="javascript:void(0)" data-toggle="popover" data-placement="bottom" data-content="<div><form action='' method='post' enctype='multipart/form-data'><div><input type='file'></div><div style='margin-top:15px;text-align:center'><input type='submit' value='确认修改'></div></form></div>" data-original-title title><b><i class="icon-file"></i> 小组资源共享</b></a></span>
					{% endifequal %}-->
<!-- 别人的小组  才有 -->
					{% ifequal status '4' %}
					<span class="btnSpan2"><a href="{% url 'groups:upload' group.id %}" type="button" class="btn btn-warning btn_file"><b><i class="icon-file"></i> 小组资源共享</b></a></span>
					{% endifequal %}

					{% ifequal status '2' %}
					<span class="btnSpan2"><a href="{% url 'groups:upload' group.id %}" type="button" class="btn btn-warning btn_file"><b><i class="icon-file"></i> 小组资源共享</b></a></span>
					{% endifequal %}
<!-- 自己的小组  才有 -->
					{% ifequal status '1' %}
					<span class="btnSpan2"><a href="{% url 'groups:upload' group.id %}" type="button" class="btn btn-warning btn_file"><b><i class="icon-file"></i> 管理小组文件</b></a></span>
					{% endifequal %}
				</div>
<!-- 举报 -->
					<div style="margin-top:20px;">
						<span class="btnSpan2"><a type="button" class="btn btn-danger btn_file" style="padding-top:10px;padding-bottom:10px;" data-toggle="modal" data-target="#bad_any">举报本小组</a></span>

						<div class="modal fade" id="bad_any" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						  <div class="modal-dialog">
						    <div class="modal-content">
						      <div class="modal-header">
						        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						        <h4 class="modal-title">举报原因</h4>
						      </div>
						      <div class="modal-body">
						        <textarea class="form-control" id="bad_content" style="height:120px;resize:none;"></textarea>
						      </div>
						      <div class="modal-footer">
						      	
						        <button type="button" onclick="bad_send({{group_id}},2);" class="btn btn-primary">举报</button>
						      </div>
						    </div><!-- /.modal-content -->
						  </div><!-- /.modal-dialog -->
						</div><!-- /.modal -->
					</div>
<!-- 举报结束 -->
<!-- 本群活跃用户 -->
				<div class="my">
					<div class="my_title"><b>本群活跃用户</b></div>
<!-- 一个本群活跃用户 循环开始处 -->
					{% for act in actman %}
					<div class="a_guy">
						<div class="pull-left person_avatar"><a href=""><img src="../avatar/{{act.1}}" class="img-circle" width="90%"/></a></div>
						<div class="pull-left person_content">
							<div><span class="person_name"><a href="{% url 'users:home' act.3 %}"><b>{{act.0}}</b></a></span><span class="focus"><button type="button" id="add{{act.3}}" onclick="add({{act.3}})" class="btn btn-info btn-xs">+ 关注</button><span id="abord{{act.3}}" style="display:none">已关注</span></span></div>
							<div class="show_person"><i>获得{{act.2}}个赞</i></div>
						</div>
						<div class="clearfix"></div>
					</div>
					{% endfor %}
<!-- 一个本群活跃用户 循环结束处 -->
				</div>
<!-- 本群活跃用户 结束处-->
				<div class="my">
					<div class="hot_title"><b>小组热门分享</b></div>
<!-- 小组热门分享 一条热门分享循环开始处 -->
					{% for t in recommend %}
					<div class="hot_intro" style="width:240px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
						<a href="{% url 'groups:thetopic' t.id %}">{{t.name}}</a>
					</div>
					{% endfor %}
<!-- 小组热门分享 一条热门分享循环结束处 -->					
				</div>
			</div>
		</div>
	</div>
	
	<script type="text/javascript">
	$('#change_img').popover({html:true});
	$('#change_intro').popover({html:true});
	$('.manage').popover({html:true});
	$('#up_file').popover({html:true});

	var xmlHttp; 

	function createXMLRequest(){
		if(window.ActiveXObject){
			xmlHttp=new ActiveXObject("Microsoft.XMLHttp");
		} else if(window.XMLHttpRequest){
			xmlHttp=new XMLHttpRequest();
		}
	}
//加入小组
	function join(id){   
		createXMLRequest();                       
		var url="/groups/join/?id="+id;
		xmlHttp.open("GET",url);
		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState==4 && xmlHttp.status==200){
				if(xmlHttp.responseText==1){
					document.getElementById('jointopub').innerHTML="<a href='{% url 'groups:topiccreate' group.id %}' type='button' class='btn btn-default'>发布新话题</a>";
				} else if(xmlHttp.responseText==2){
					document.getElementById('jointopub').innerHTML="请加入小组后添加话题!";
				}
			}
		};
		xmlHttp.send(); 
	}
	</script>
</body>
</html>